/**
 * 详情对话框
 */
var CbAbnormalBackInfoDlg = {
    data: {
        id: "",
        typeName: "",
        suggest: "",
        images: "",
        contact: "",
        remark: "",
        createTime: "",
        createUser: "",
        updateTime: "",
        updateUser: ""
    }
};

layui.use(['form', 'admin', 'ax','laydate','upload','formSelects'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;




















    //获取详情信息，填充表单
    var ajax = new $ax(Feng.ctxPath + "/api/abnormal_back/detail?id=" + Feng.getUrlParam("id"));
    var result = ajax.start();
    var img_url = result.data.images;
    var urls = img_url.split(',');
    for (var i = 0; i < urls.length; i++) {
        // var url = 'http://localhost:8084/api/fastdfs/stream_file?fileId='+urls[i];
        var url = Feng.ctxPath+'/api/oss/stream_file?objectName='+urls[i];
        $('#imgs').append("<img id='atlas-img' style='width: 150px; height: 150px;' src='"+url+"' onclick='previewImg(this)'>");
    }

    form.val('cbAbnormalBackForm', result.data);


    $('#cancel').click(function(){
        window.location.href = Feng.ctxPath + '/api/abnormal_back'
    });
});
function previewImg(obj) {
    var img = new Image();
    img.src = obj.src;
    var imgHtml = "<img src='" + obj.src + "' width='500px' height='500px'/>";
    //弹出层
    layer.open({
        type: 1,
        shade: 0.8,
        offset: 'auto',
        area: [500 + 'px',550+'px'],
        shadeClose:true,
        scrollbar: false,
        title: "图片预览", //不显示标题
        content: imgHtml, //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
        cancel: function () {
            //layer.msg('捕获就是从页面已经存在的元素上，包裹layer的结构', { time: 5000, icon: 6 });
        }
    });
}